/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.util.Calendar;
import java.util.Date;
import org.primefaces.model.DefaultScheduleEvent;


public class CustumEvent extends DefaultScheduleEvent{
    /*
     * private String id;
	
	private String title;
	
	private Date startDate;
	
	private Date endDate;
	
	private boolean allDay = false;
	
	private String styleClass;
	
	private Object data;
    
    private boolean editable = true;
     */
    private String anneeDebut;
    private String anneeFin;
    private String moisDebut;
    private String moisFin;
    private String jourDebut;
    private String jourFin;

    public String getAnneeDebut() {
        return anneeDebut;
    }

    public void setAnneeDebut(String anneeDebut) {
        this.anneeDebut = anneeDebut;
    }

    public String getAnneeFin() {
        return anneeFin;
    }

    public void setAnneeFin(String anneeFin) {
        this.anneeFin = anneeFin;
    }

    public String getMoisDebut() {
        return moisDebut;
    }

    public void setMoisDebut(String moisDebut) {
        this.moisDebut = moisDebut;
    }

    public String getMoisFin() {
        return moisFin;
    }

    public void setMoisFin(String moisFin) {
        this.moisFin = moisFin;
    }

    public String getJourDebut() {
        return jourDebut;
    }

    public void setJourDebut(String jourDebut) {
        this.jourDebut = jourDebut;
    }

    public String getJourFin() {
        return jourFin;
    }

    public void setJourFin(String jourFin) {
        this.jourFin = jourFin;
    }
    private String heureDebut;
    private String heureFin;
    private String minuteDebut;
    private String minuteFin;
    private String localisation;

    public String getLocalisation() {
        return localisation;
    }

    public void setLocalisation(String localisation) {
        setData(localisation);
        this.localisation = localisation;
    }

    public void setHeureDebut(String heureDebut) {
        this.heureDebut = heureDebut;
    }

    public void setHeureFin(String heureFin) {
        this.heureFin = heureFin;
    }

    public void setMinuteDebut(String minuteDebut) {
        this.minuteDebut = minuteDebut;
    }

    public void setMinuteFin(String minuteFin) {
        this.minuteFin = minuteFin;
    }

    public String getHeureDebut() {
        return heureDebut;
    }

    public String getHeureFin() {
        return heureFin;
    }

    public String getMinuteDebut() {
        return minuteDebut;
    }

    public String getMinuteFin() {
        return minuteFin;
    }
    public CustumEvent(){
        super();
    }
    public Date getDateDebut(){
        Calendar calendar=Calendar.getInstance();
        int hd=Integer.parseInt(heureDebut);
        /*if(hd<12)
        calendar.set(Calendar.AM_PM,Calendar.AM);
        else {
            calendar.set(Calendar.AM_PM,Calendar.PM);
            hd-=12;
        }*/
        calendar.set(Integer.parseInt(anneeDebut), Integer.parseInt(moisDebut)-1, Integer.parseInt(jourDebut), hd, Integer.parseInt(minuteDebut));
        //System.out.println("date: "+calendar.getTime());
        return calendar.getTime();
    }
    public Date getDateFin(){
        Calendar calendar=Calendar.getInstance();
        int hd=Integer.parseInt(heureFin);
        if(hd<12)
        calendar.set(Calendar.AM_PM,Calendar.AM);
        else {
            calendar.set(Calendar.AM_PM,Calendar.PM);
            hd-=12;
        }
        calendar.set(Integer.parseInt(anneeFin), Integer.parseInt(moisFin)-1, Integer.parseInt(jourFin), hd, Integer.parseInt(minuteFin));
        return calendar.getTime();
    }
    
}
